Skip to content

fix: adjust scroll margins for anonymous consent management banner and form elements of the register page#21343

Open
npapp-dev002 wants to merge 3 commits intodevelopfrom
fix/CXSPA-12260
Open

fix: adjust scroll margins for anonymous consent management banner and form elements of the register page#21343
npapp-dev002 wants to merge 3 commits intodevelopfrom
fix/CXSPA-12260

Conversation

@npapp-dev002
Copy link
Copy Markdown
Contributor

fix(register): scroll focused form fields into view above the anonymous consent banner

Problem

The cx-anonymous-consent-management-banner component renders as a position: fixed; bottom: 0 overlay at the bottom of the viewport. When a user navigates the registration form using the Tab key, the browser's native focus-scroll behaviour does not account for the fixed banner, causing focused form fields to be obscured behind it.

Solution

A pure CSS fix was applied using two complementary browser-native scroll properties:

  • scroll-padding-bottom on the html element — instructs the browser to reserve bottom clearance equal to the banner height whenever it auto-scrolls a focused element into view. Applied conditionally via :has() so it is only active when the banner is actually visible.
  • scroll-margin-bottom on register form groups and focusable elements — ensures each focusable element declares its own required bottom margin from the viewport edge, centering it in the visible area above the banner on Tab focus.

A shared SCSS variable ($cx-anonymous-consent-banner-height) was introduced to avoid magic numbers and keep all related offsets in sync.

Notes

  • No JavaScript changes — the fix is entirely CSS-based.
  • The $cx-anonymous-consent-banner-height variable uses rem units (instead of px) to respect the user's browser font-size settings, which aligns with the existing codebase conventions and improves accessibility.
  • The !default flag allows consuming applications or custom themes to override the value if needed.
  • The :has() selector ensures scroll-padding-bottom is only applied when the banner is rendered and visible, avoiding any side effects on other pages.

QA steps

  1. authorizationCodeFlowByDefault feature flag needs to be set to false in order to make the registration page visible.
  2. Click on Sign in / Registration and try to use Tab button to navigate between elements.
  3. They should be positioned in the center of the page after every Tab button press.

@npapp-dev002 npapp-dev002 requested review from a team as code owners April 7, 2026 15:43
@github-actions github-actions bot marked this pull request as draft April 7, 2026 15:43
@npapp-dev002 npapp-dev002 marked this pull request as ready for review April 8, 2026 11:50
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

Merge Checks Failed

Please push a commit to re-trigger the build.
To push an empty commit you can use `git commit --allow-empty -m "Trigger Build"`

@github-actions github-actions bot marked this pull request as draft April 8, 2026 11:51
@npapp-dev002 npapp-dev002 marked this pull request as ready for review April 8, 2026 12:41
@cypress
Copy link
Copy Markdown

cypress bot commented Apr 8, 2026

spartacus    Run #52664

Run Properties:  status check passed Passed #52664  •  git commit 4d89b60e2a ℹ️: Merge 9eded2285c2a319f15fd8a136d8aa56f91b0bffa into 72b68155595486ab55f4396df4f8...
Project spartacus
Branch Review fix/CXSPA-12260
Run status status check passed Passed #52664
Run duration 04m 19s
Commit git commit 4d89b60e2a ℹ️: Merge 9eded2285c2a319f15fd8a136d8aa56f91b0bffa into 72b68155595486ab55f4396df4f8...
Committer Norbert Papp
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 3
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 101
View all changes introduced in this branch ↗︎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant